<template>
  <div class="dashboard-container">
    <Card :data-source="infoCard" />
    <el-row :gutter="8">
      <el-col :span="24">
        <el-card>
          <inst-cat-stats />
        </el-card>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import Card from '@neu/biz-core/components/Card'
import InstCatStats from '@neu/cmdb-ui/components/stats/InstCatStats'
import { countOfModels, countOfLocations, countOfSchemas, countOfAssets, countOfItAssets, countOfPdgs } from '@neu/dcvm-ui/api/statistic'
export default {
  name: 'DcvmDashboard',
  components: {
    Card,
    InstCatStats
  },
  data() {
    return {
      infoCard: [ // 卡片
        { name: '模具总数', total: '--', icon: 'todo', totalColor: 'primary' },
        { name: '位置总数', total: '--', icon: 'alarm', totalColor: 'primary' },
        { name: '模型总数', total: '--', icon: 'unusual', totalColor: 'primary' },
        { name: '资产总数', total: '--', icon: 'info', totalColor: 'primary' },
        { name: 'IT资产总数', total: '--', icon: 'info', totalColor: 'primary' },
        { name: '配电柜总数', total: '--', icon: 'monitor', totalColor: 'primary' }
      ]
    }
  },
  created() {
    this.loadCountStatis()
  },
  methods: {
    loadCountStatis() {
      countOfModels().then(response => {
        this.infoCard[0].total = response.data
      })
      countOfLocations().then(response => {
        this.infoCard[1].total = response.data
      })
      countOfSchemas().then(response => {
        this.infoCard[2].total = response.data
      })
      countOfAssets().then(response => {
        this.infoCard[3].total = response.data
      })
      countOfItAssets().then(response => {
        this.infoCard[4].total = response.data
      })
      countOfPdgs().then(response => {
        this.infoCard[5].total = response.data
      })
    }
  }
}
</script>
<style lang="scss" scoped>

</style>
